package com.rr.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rr.entity.Person;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

/**
 * @author RR
 * @date 2022/8/21 17:06
 */
@RestController
public class ValidatorController {
    @PostMapping("/sendPerson")
    public String sendPerson(@Validated @RequestBody Person person) throws JsonProcessingException {
        return new ObjectMapper().writeValueAsString(person);
    }

    public static void main(String[] args) {
        List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8);
    }
}
